﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ENG.TeachersDiary.Model;

namespace ENG.TeachersDiary
{
  public partial class FrmMarkCodes : Form
  {
    DiaryDB db;

    public FrmMarkCodes()
    {
      InitializeComponent();

      ReDB();
    }

    private void FrmMarkCodes_Load(object sender, EventArgs e)
    {
      if (db.Marks.Count() > 0)
        MessageBox.Show(
          Properties.Resources.DontChangeMarksWarning, 
          Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
    }

    private void ReDB()
    {
      db = Common.DBConn;
      markCodeBindingSource.DataSource = db.MarkCodes;
    }

    private void FrmMarkCodes_FormClosing(object sender, FormClosingEventArgs e)
    {
      db.SubmitChanges();
    }
  }
}
